package com.sh.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum TransferDescEnum {


    /**
     * 算力设备采购
     */
    MINING_MACHINE_ALLOCATION(10010, "算力设备采购"),

    /**
     * 市场提成
     */
    MARKET_COMMISSION_ALLOCATION(10011, "市场提成"),

    /**
     * 运营
     */
    OPERATION_ALLOCATION(10012, "运营"),

    /**
     * 基金
     */
    FUND_ALLOCATION(10013, "基金"),

    /**
     * 市场推广
     */
    MARKET_PROMOTION_ALLOCATION(10014, "市场推广"),


    // ------------------用户端--------------------

    /**
     * 充值复购u
     */
    RECHARGE(10018,"充值复购u"),

    /**
     * 提现手续费
     */
    WITHDRAW_FEE(10019,"提现手续费"),

    /**
     * 提现
     */
    WITHDRAW(10020,"提现"),

    /**
     * 购买矿机
     */
    PURCHASE_MINING(10021,"购买矿机"),

    /**
     * 直推奖励
     */
    PURCHASE_MINING_DIRECT_PUSH(10022,"直推奖励"),

    /**
     * 直推自定义奖励
     */
    PURCHASE_MINING_DIRECT_PUSH_CUSTOMIZE(10024,"直推自定义奖励"),

    /**
     * 间推奖励
     */
    PURCHASE_MINING_INDIRECT_PUSH(10023,"间推奖励"),


    /**
     * 团队奖励
     */
    TEAM_REWARD(10030,"团队奖励"),

    /**
     * 平级奖励
     */
    LEVEL_REWARD(10031,"平级奖励"),

    /**
     * 挖矿奖励
     */
    MINING_REWARD(10032,"算力产出"),

    /**
     * 分红
     */
    MINING_BONUS_REWARD(10033,"分红"),

    /**
     * 提现失败
     */
    WITHDRAW_AUDIT_REJECT(10040,"提现失败"),

    /**
     * 公司回收
     */
    COMPANY_RECOVERY(10100,"公司回收"),

    /**
     * 购买
     */
    PURCHASE(10101,"购买"),

    /**
     * 空投
     */
    AIRDROP(10102,"空投"),

    /**
     * 动静态发放
     */
    DYNAMIC_AND_STATIC(101021,"动静态发放"),

    /**
     * 转账到理财
     */
    TRANSFER_TO_FINANCING(10103,"转账到理财"),

    /**
     * 转入
     */
    TRANSFER_IN(101030,"转入"),

    /**
     * 提取
     */
    EXTRACT(101031, "提取"),

    /**
     * 理财收益
     */
    FINANCING_INCOME(10104, "理财收益"),

    /**
     * 转账
     */
    TRANSFER(10105, "转账"),

    /**
     * 社区扶持
     */
    COMMUNITY_SUPPORT(10106, "社区扶持"),


    /**
     * 兑换
     */
    EXCHANGE(10108, "兑换"),





    ;

    private final Integer code;
    private final String desc;

    public static TransferDescEnum of(Integer code) {
        Objects.requireNonNull(code, "类型不存在系统");
        return Stream.of(values()).filter(item -> item.code.equals(code))
            .findAny()
            .orElseThrow(() -> new IllegalArgumentException(
                String.format("%s%s", code, "类型不存在系统")
            ));
    }
}
